#ifndef __MPP_DISPLAY_DEV_H__
#define __MPP_DISPLAY_DEV_H__


#include <drm.h>
#include <drm_fourcc.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include <stdint.h>
#include <string>
#include <vector>
using namespace std;


class mpp_display_dev
{
    public :
        mpp_display_dev(string path);
        virtual ~mpp_display_dev();
    protected:
        // typedef struct  {
        //     int pipe;
        //     int num_planes;
        //     struct sp_bo *scanout;
        // }mpp_sp_crtc, *mpp_sp_crtc_Ptr;

        int mpp_display_init_element();

        virtual vector<drmModeConnectorPtr>  mpp_element_create_connect(int fd,uint32_t count_connectors,uint32_t *connectors) {
            vector<drmModeConnectorPtr> tmp;
            return tmp;
        }
        
        virtual void mpp_element_distroy_connect(int fd,vector<drmModeConnectorPtr> connectors){

        }//uint32_t count_connectors,drmModeConnectorPtr *connector

        virtual vector<drmModeEncoderPtr>  mpp_element_create_encoder(int fd,uint32_t count_encoders,uint32_t *encoders){
            vector<drmModeEncoderPtr> tmp;
            return tmp;
        }
        virtual void mpp_element_distroy_encoder(int fd,vector<drmModeEncoderPtr> encoders){

        }//uint32_t count_encoders,drmModeEncoderPtr *encoders


        virtual vector<drmModeCrtcPtr> mpp_element_create_crtc(int fd,uint32_t count_crtcs,uint32_t *crtcs){
            vector<drmModeCrtcPtr> tmp;
            return tmp;
        }
        virtual void mpp_element_distroy_crtc(int fd,vector<drmModeCrtcPtr> crtcs){
            
        }//uint32_t count_crtcs,drmModeCrtcPtr *crtc

    protected:
        vector<drmModeConnectorPtr> mpp_dev_get_connectors();
        vector<drmModeEncoderPtr> mpp_dev_get_encoders();
        vector<drmModeCrtcPtr> mpp_dev_get_crtcs();
        int mpp_display_dev_get_fd();
        int mpp_display_dev_setCrtc(uint32_t crtcId, uint32_t bufferId,
                   uint32_t x, uint32_t y, uint32_t *connectors, int count,
		            drmModeModeInfoPtr mode);
    private:
        void distroy_all();

        vector<drmModeConnectorPtr> connectors;
        vector<drmModeEncoderPtr> encoders;
        vector<drmModeCrtcPtr> crtcs;

        // drmModeConnectorPtr* connectors;
        // drmModeEncoderPtr*     encoders;
        // drmModeCrtcPtr*            crtcs;


        // uint32_t count_connectors;
        // uint32_t count_encoders;
        // uint32_t count_crtcs;
        int fd;
};


#endif